<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <?php include_once MvcReg::$_moduleName . '/views/layout/head.php'; ?>

</head>
<body>
<?php include_once MvcReg::$_moduleName . '/views/layout/header.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/layout/top-nav.php'; ?>
<div id="main">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-2">
                <?php include_once MvcReg::$_moduleName . '/views/layout/left_menu.php'; ?>
            </div>
            <div class="col-md-12">
                <div class="right-content">
                    <h3>
                        <?php echo $menu["breadcrumb_current"] ?>
                    </h3>
                    <br>
                    <form name="mainforma" action="" method="get">
                        <?php echo $hidden_data ?>
                        <div class="table-responsive">
                            <div class="panel panel-default">
                                <div class="panel-body form-inline">
                                    <div class="form-group">
                                        <label>骑手姓名:</label>
                                        <input type="text" name="q_name" value="<?php echo $q_name ?>" class="form-control input-sm" placeholder=""/>
                                    </div>
                                    <div class="form-group">
                                        <label>骑手电话:</label>
                                        <input type="text" name="q_mobile" value="<?php echo $q_mobile ?>" class="form-control input-sm" placeholder=""/>
                                    </div>

                                    <div class="form-group">
                                        <label>骑手状态:</label>
                                        <?php echo Tools::selectOptions("_riders_status_code",Data::$_riders_status_code, '--请选择--', true, $_riders_status_code, 'class="form-control select" '); ?>
                                    </div>

                                    <div class="form-group">
                                        <label>健康证起始时间:</label>
                                        <div class="input-group">
                                            <span class="input-group-addon">
                                                <span class="glyphicon glyphicon-calendar">
                                                </span>
                                            </span>
                                            <input size="16" type="text" name="jkz_start" readonly=""
                                                   class="form_datetime form-control"
                                                   value="<?php echo $jkz_start ?>">
                                            <span class="input-group-addon">
                                                至
                                            </span>
                                            <input size="16" type="text" name="jkz_end" readonly=""
                                                   class="form_datetime form-control" value="<?php echo $jkz_end ?>">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label>骑手建立时间:</label>
                                        <input size="16" type="text" name="createdt" readonly="" class="form_datetime form-control" value="<?php echo $createdt ?>">
                                    </div>

                                    <button type="submit" class="btn btn-primary"><span
                                                class="glyphicon glyphicon-search"></span>立即查询
                                    </button>
                                </div>
                            </div>
                            <table class="table table-hover">
                                <thead>
                                <tr class="info">
                                    <th>序</th>
                                    <th>骑手姓名</th>
                                    <th>骑手电话</th>
                                    <th>服务城市</th>
                                    <th>服务门店</th>
                                    <th>健康证起始时间</th>
                                    <th>骑手建立时间</th>
                                    <th>状态</th>
                                    <th>操作区</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                if($rsp_list){

                                $n = 0;
                                foreach ($rsp_list as $k => $row) {
                                    $n++;
                                    $item = $n + ($page - 1) * $number_page;
                                    $id = $row["id"];

                                    ?>
                                    <tr  id="<?php echo $id ?>" >
                                        <td><?php echo $item ?></td>
                                        <td class="pcontent"><?php echo $row['name'];?></td>
                                        <td class="pcontent"><?php echo $row['tel'];?></td>
                                        <td class="pcontent"><?php echo $row['service_city_name'];?></td>
                                        <td class="pcontent"><?php echo $_SESSION['zp_shop']['store_name'];?></td>
                                        <?php if($row['jkz_start']){
                                            echo  '<td> '.strstr($row['jkz_start'], ' ',true).' 至 '.strstr($row['jkz_end'], ' ',true) .'</td>';
                                        }else{echo  '<td> </td>';}?>
                                        <td><?php echo  $row['createdt'] ?></td>

                                        <?php if($row['initiate'] == 2){
                                            echo '<td class="pcontent">禁用</td>';
                                        }else{
                                            echo '<td class="pcontent">启用</td>';
                                        }
                                        ?>
                                        <td>
                                            <div>
                                                <?php if($row['initiate'] == 2){
                                                   $status = '启用';
                                                }else{
                                                    $status = '禁用';
                                                }
                                                ?>
                                                <button type="button" class="btn btn-primary"  onclick="forbidden('<?php echo $id?>')" ><?php echo $status; ?></button>
                                                <button type="button" class="btn btn-primary"  data-toggle="modal" data-target="#check_horse"  onclick="edit('<?php echo $id; ?>', '<?php echo $page; ?>','<?php echo $this_url?>_check')">查看</button>
                                            </div>
                                        </td>
                                    </tr>
                                <?php }
                                }
                                ?>
                                </tbody>
                            </table>
                            <div class="page">
                                <div class="pagination pull-left">共<?php echo $total_count ?>笔记录</div>
                                <?php if (!empty($rsp_page_list)) echo $rsp_page_list; ?>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php include_once MvcReg::$_moduleName . '/views/layout/footer.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/dialog/express_order_setting.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/dialog/express_order_cancel.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/dialog/express_horse_forbidden.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/dialog/express_horse_check.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/dialog/del_order.php'; ?>
<script>
    $(".form_datetime").datetimepicker({
        format: "yyyy-mm-dd",
        minView: 'month',
        todayBtn: 1,
        autoclose:true,
    });
    function forbidden(id) {
        $.ajax({
            url:"?md=shop&cl=shop&at=horse",
            dataType:"json",
            type:"post",
            data:{'horse_id':id},
            success:function (d) {
                if(d.status == 1){
                    alert(d.msg);
                    location.href = '?md=shop&cl=shop&at=?md=shop&cl=shop&at=horselist';
                }
            }
        })
    }
</script>
</body>
</html>
